<template>
  <div class="welcome" :style="{ backgroundImage: `url(${bgImage})` }">
    <div class="cyber-overlay"></div>
    <div class="content">
      <h1 class="cyber-title">欢迎登录桂林市气温预测系统！</h1>
      <div class="button-container">
        <button 
          class="cyber-button"
          @click="navigateToLogin"
        >
          <span class="glitch" data-text="点击登录进入">点击登录进入</span>
          <span class="cyber-line"></span>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import bgImage from '@/assets/guilin.jpg'

const router = useRouter()
const navigateToLogin = () => router.push('/login')
</script>

<style scoped>
.welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.cyber-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 255, 0.1));
  pointer-events: none;
}

.content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.cyber-title {
  font-size: 3rem;
  color: #fff;
  text-shadow: 0 0 10px #0ff,
               0 0 20px #0ff,
               0 0 30px #0ff;
  margin-bottom: 3rem;
  font-family: 'Arial', sans-serif;
  letter-spacing: 2px;
  animation: glow 2s ease-in-out infinite alternate;
}

.button-container {
  position: relative;
}

.cyber-button {
  padding: 1.2rem 3rem;
  font-size: 1.3rem;
  background: rgba(0, 0, 0, 0.7);
  color: #0ff;
  border: 2px solid #0ff;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.cyber-button:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 20px #0ff;
}

.cyber-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #0ff;
  transform: translateX(-100%);
  animation: line-move 2s linear infinite;
}

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.glitch::before {
  color: #ff0;
  animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

.glitch::after {
  color: #f0f;
  animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
}

@keyframes glow {
  from {
    filter: brightness(100%);
  }
  to {
    filter: brightness(150%);
  }
}
/* 正常风格 */
.normal-mode {
  background: #fff;
  color: #333;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.normal-mode .title {
  color: #2c3e50;
  font-weight: normal;
}

.normal-mode .button {
  background: #409eff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  transition: all 0.3s;
}

.normal-mode .button:hover {
  background: #66b1ff;
}

/* 科幻风格 - 更加刺眼的效果 */
.cyber-mode {
  background: #000;
  color: #0ff;
  text-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 30px #0ff;
  box-shadow: 0 0 20px #0ff, inset 0 0 20px #0ff;
  animation: glow 1s ease-in-out infinite alternate;
}

.cyber-mode .title {
  color: #0ff;
  text-shadow: 0 0 15px #0ff, 0 0 25px #0ff, 0 0 35px #0ff;
  font-weight: bold;
  letter-spacing: 2px;
}

.cyber-mode .button {
  background: rgba(0, 255, 255, 0.2);
  color: #0ff;
  border: 2px solid #0ff;
  padding: 10px 20px;
  text-shadow: 0 0 10px #0ff;
  box-shadow: 0 0 20px #0ff;
  animation: pulse 2s infinite;
}

.cyber-mode .button:hover {
  background: rgba(0, 255, 255, 0.4);
  box-shadow: 0 0 30px #0ff;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 20px #0ff;
  }
  50% {
    box-shadow: 0 0 40px #0ff;
  }
  100% {
    box-shadow: 0 0 20px #0ff;
  }
}

@keyframes line-move {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes glitch {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}
</style>